﻿using StardewValley;
using StardewValley.Monsters;

namespace WorseGame.Content.怪物增强
{
    public class 臭虫增强器 : 怪物增强器
    {
        public override void 应用增强(Monster 怪物)
        {
            Grub? 臭虫 = (Grub)怪物;
            if (臭虫 != null)
            {
                臭虫.speed *= 2;
                臭虫.moveTowardPlayerThreshold.Value = 3;
                if (Game1.random.NextDouble() < 0.05 && 臭虫.Health < 臭虫.MaxHealth / 2)
                {
                    变成苍蝇(臭虫);
                }
            }
        }
        private static void 变成苍蝇(Grub 臭虫)
        {
            var 位置 = 臭虫.currentLocation;
            if (位置 != null)
            {
                var 飞蝇 = new Fly(臭虫.Position)
                {
                    MaxHealth = (int)(臭虫.MaxHealth * 0.8f)
                };
                飞蝇.Health = 飞蝇.MaxHealth;
                飞蝇.DamageToFarmer = (int)(臭虫.DamageToFarmer * 1.2f);
                位置.characters.Remove(臭虫);
                位置.characters.Add(飞蝇);
                Game1.playSound("debuffSpell");
            }
        }
        protected override float 计算难度系数()
        {
            float 基础系数 = base.计算难度系数();
            return 基础系数 * 1.1f;
        }
    }
}
